const express = require("express");
const router = express.Router();

const {
  getAllMedias,
  updateMediaIsShow,
  deleteMedia,
} = require("../../router_handler/admin/media");
router.get("/allVideos/:page/:limit/:type", async (req, res) => {
  const { page, limit, type } = req.params;
  const result = await getAllMedias(page, limit, type, "video");

  res.send(result);
});
router.get("/allImages/:page/:limit/:type", async (req, res) => {
  const { page, limit, type } = req.params;
  const result = await getAllMedias(page, limit, type, "image");

  res.send(result);
});
router.post("/updateIsShow/:id/:is_show", async (req, res) => {
  const { id, is_show } = req.params;
  const result = await updateMediaIsShow(id, is_show);
  res.send(result);
});
router.delete("/delete/:id", async (req, res) => {
  const { id } = req.params;
  const result = await deleteMedia(id);
  res.send(result);
});
module.exports = router;
